﻿namespace MvcFckEditor.Components
{
    using System;
    using System.Collections;
    using System.Runtime.CompilerServices;

    internal class TypeConfig
    {
        internal bool CheckIsAllowedExtension(string extension)
        {
            if ((this.AllowedExtensions.Length == 0) && (this.DeniedExtensions.Length == 0))
            {
                return false;
            }
            if (!((this.DeniedExtensions.Length <= 0) || Util.ArrayContains(this.DeniedExtensions, extension, CaseInsensitiveComparer.DefaultInvariant)))
            {
                return false;
            }
            if (!((this.AllowedExtensions.Length <= 0) || Util.ArrayContains(this.AllowedExtensions, extension, CaseInsensitiveComparer.DefaultInvariant)))
            {
                return false;
            }
            return true;
        }

        public string[] AllowedExtensions { get; set; }

        public string[] DeniedExtensions { get; set; }

        public string FilesPath { get; set; }
    }
}

